<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: src/core/ipv4/ip4_addr.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('ip4__addr_8c.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">ip4_addr.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="opt_8h.html">lwip/opt.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="ip__addr_8h.html">lwip/ip_addr.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="netif_8h.html">lwip/netif.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ab3cd7e7fba28c29d35f3c17461071421"><td class="memItemLeft" align="right" valign="top">u8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8c.html#ab3cd7e7fba28c29d35f3c17461071421">ip4_addr_isbroadcast_u32</a> (u32_t addr, const struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:ab3cd7e7fba28c29d35f3c17461071421"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab5810d404b0ad1b89ef1323ea1e78071"><td class="memItemLeft" align="right" valign="top">u8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8c.html#ab5810d404b0ad1b89ef1323ea1e78071">ip4_addr_netmask_valid</a> (u32_t netmask)</td></tr>
<tr class="separator:ab5810d404b0ad1b89ef1323ea1e78071"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c05f9138da41115978409e547df9670"><td class="memItemLeft" align="right" valign="top">u32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8c.html#a2c05f9138da41115978409e547df9670">ipaddr_addr</a> (const char *cp)</td></tr>
<tr class="separator:a2c05f9138da41115978409e547df9670"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af66de98501e92c66714d58119b6d9e1a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8c.html#af66de98501e92c66714d58119b6d9e1a">ip4addr_aton</a> (const char *cp, <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *addr)</td></tr>
<tr class="separator:af66de98501e92c66714d58119b6d9e1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28620fdd443c5c98d15e5890cbd9059c"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8c.html#a28620fdd443c5c98d15e5890cbd9059c">ip4addr_ntoa</a> (const <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *addr)</td></tr>
<tr class="separator:a28620fdd443c5c98d15e5890cbd9059c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3825d5b4786c207af971ceb287f101fd"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ip4__addr_8c.html#a3825d5b4786c207af971ceb287f101fd">ip4addr_ntoa_r</a> (const <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *addr, char *buf, int buflen)</td></tr>
<tr class="separator:a3825d5b4786c207af971ceb287f101fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This is the IPv4 address tools implementation. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ab3cd7e7fba28c29d35f3c17461071421"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3cd7e7fba28c29d35f3c17461071421">&#9670;&nbsp;</a></span>ip4_addr_isbroadcast_u32()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8_t ip4_addr_isbroadcast_u32 </td>
          <td>(</td>
          <td class="paramtype">u32_t&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>netif</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Determine if an address is a broadcast address on a network interface</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">addr</td><td>address to be checked </td></tr>
    <tr><td class="paramname">netif</td><td>the network interface against which the address is checked </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>returns non-zero if the address is a broadcast address </dd></dl>

</div>
</div>
<a id="ab5810d404b0ad1b89ef1323ea1e78071"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab5810d404b0ad1b89ef1323ea1e78071">&#9670;&nbsp;</a></span>ip4_addr_netmask_valid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8_t ip4_addr_netmask_valid </td>
          <td>(</td>
          <td class="paramtype">u32_t&#160;</td>
          <td class="paramname"><em>netmask</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Checks if a netmask is valid (starting with ones, then only zeros)</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">netmask</td><td>the IPv4 netmask to check (in network byte order!) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if the netmask is valid, 0 if it is not </dd></dl>

</div>
</div>
<a id="af66de98501e92c66714d58119b6d9e1a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af66de98501e92c66714d58119b6d9e1a">&#9670;&nbsp;</a></span>ip4addr_aton()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ip4addr_aton </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>cp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *&#160;</td>
          <td class="paramname"><em>addr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Check whether "cp" is a valid ascii representation of an Internet address and convert to a binary address. Returns 1 if the address is valid, 0 if not. This replaces inet_addr, the return value from which cannot distinguish between failure and a local broadcast address.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">cp</td><td>IP address in ascii representation (e.g. "127.0.0.1") </td></tr>
    <tr><td class="paramname">addr</td><td>pointer to which to save the ip address in network order </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if cp could be converted to addr, 0 on failure </dd></dl>

</div>
</div>
<a id="a28620fdd443c5c98d15e5890cbd9059c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a28620fdd443c5c98d15e5890cbd9059c">&#9670;&nbsp;</a></span>ip4addr_ntoa()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* ip4addr_ntoa </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *&#160;</td>
          <td class="paramname"><em>addr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convert numeric IP address into decimal dotted ASCII representation. returns ptr to static buffer; not reentrant!</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">addr</td><td>ip address in network order to convert </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>pointer to a global static (!) buffer that holds the ASCII representation of addr </dd></dl>

</div>
</div>
<a id="a3825d5b4786c207af971ceb287f101fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3825d5b4786c207af971ceb287f101fd">&#9670;&nbsp;</a></span>ip4addr_ntoa_r()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* ip4addr_ntoa_r </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="ip4__addr_8h.html#a3d3b45daffbc15d65da236e31e621b7e">ip4_addr_t</a> *&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>buflen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Same as ip4addr_ntoa, but reentrant since a user-supplied buffer is used.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">addr</td><td>ip address in network order to convert </td></tr>
    <tr><td class="paramname">buf</td><td>target buffer where the string is stored </td></tr>
    <tr><td class="paramname">buflen</td><td>length of buf </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>either pointer to buf which now holds the ASCII representation of addr or NULL if buf was too small </dd></dl>

</div>
</div>
<a id="a2c05f9138da41115978409e547df9670"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2c05f9138da41115978409e547df9670">&#9670;&nbsp;</a></span>ipaddr_addr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32_t ipaddr_addr </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>cp</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Ascii internet address interpretation routine. The value returned is in network order.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">cp</td><td>IP address in ascii representation (e.g. "127.0.0.1") </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ip address in network order </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_aebb8dcc11953d78e620bbef0b9e2183.html">core</a></li><li class="navelem"><a class="el" href="dir_a32e111ee6805cfc63488fd2d37f2390.html">ipv4</a></li><li class="navelem"><a class="el" href="ip4__addr_8c.html">ip4_addr.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
